package cn.the.angry.anim;

import java.awt.Image;

public class DamageableObject extends AbstractObject{
	private final int FULL = 100;
    private int life;
    
    public DamageableObject(){
            life = FULL;
    }
    
    public DamageableObject(Image[] frames){
            super(frames);
            life = FULL;
    }
    
    @Override
	public Image getImage(){
    	return frames[!isDestory()?(FULL-life) * (frames.length-1) / FULL:frames.length-1];
    }
    
	public int getLife()
	{
		return life;
	}

	public void setLife(int life)
	{
		this.life = life;
	}
	
	public boolean isDestory()
	{
		return life<=0;
	}
}